#ifndef WEBSOCKETSERVER_H
#define WEBSOCKETSERVER_H

#include <QObject>
#include<QWebSocketServer>
#include<QProtobufSerializer>
#include<QWebSocket>
#include<QAbstractSocket>

class WebSocketServer : public QObject
{
    Q_OBJECT
private:
    QWebSocketServer webSocketServer;

    QProtobufSerializer serializer;

    int messageIndex = 0;

    static WebSocketServer* instance;
    WebSocketServer():webSocketServer("Qt WebSocket Server",QWebSocketServer::NonSecureMode){}
public:
    static WebSocketServer* getInstance();

    bool init();




signals:
    //发送消息给客户端
    void sendTextResp();
    //删除好友
    void sendFriendRemove();
    //添加好友
    void sendFriendApply();

    //好友申请被同意或拒绝通知
    void sendFriendProcess(bool agree);

    //创建会话
    void sendNewChatSession();
};

#endif // WEBSOCKETSERVER_H
